[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Mon, 29 Jun 2009 02:26:05 +0000 (11:26 +0900)
committerIsaku Yamahata <yamahata@valinux.co.jp>
Mon, 29 Jun 2009 02:26:05 +0000 (11:26 +0900)
don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/arch/ia64/vmx/viosapic.c
xen/arch/ia64/vmx/vlsapic.c
xen/arch/ia64/vmx/vmx_init.c
xen/arch/ia64/vmx/vmx_vcpu_save.c
xen/arch/ia64/xen/dom0_ops.c
xen/arch/ia64/xen/dom_fw_dom0.c
xen/arch/ia64/xen/domain.c
xen/arch/ia64/xen/hypercall.c
xen/arch/ia64/xen/vhpt.c
xen/include/asm-ia64/vcpumask.h

index 8922fbe2dc3b242134b88a3a55773f3248116161..2efdb49154f64b0f61f0edb5537989c5e7848396 100644 (file)
@@ -378,7 +378,7 @@ static int viosapic_load(struct domain *d, hvm_domain_context_t *h)
         return -EINVAL;
 
     lowest_vcpu = NULL;
-    if (viosapic_load.lowest_vcpu_id < MAX_VIRT_CPUS)
+    if (viosapic_load.lowest_vcpu_id < d->max_vcpus)
         lowest_vcpu = d->vcpu[viosapic_load.lowest_vcpu_id];
     else if (viosapic_load.lowest_vcpu_id != VIOSAPIC_INVALID_VCPU_ID)
         return -EINVAL;
index e0a063afbfcab8b248c342a099231e6ad9e6ed12..b382e0b9c053278ac64089795781c1cf6e421219 100644 (file)
@@ -153,7 +153,7 @@ static void vtm_reset(VCPU *vcpu)
 
     if (vcpu->vcpu_id == 0) {
         vtm_offset = 0UL - ia64_get_itc();
-        for (i = MAX_VIRT_CPUS - 1; i >= 0; i--) {
+        for (i = d->max_vcpus - 1; i >= 0; i--) {
             if ((v = d->vcpu[i]) != NULL) {
                 VMX(v, vtm).vtm_offset = vtm_offset;
                 VMX(v, vtm).last_itc = 0;
@@ -227,7 +227,7 @@ void vtm_set_itc(VCPU *vcpu, uint64_t new_itc)
     vtm = &VMX(vcpu, vtm);
     if (vcpu->vcpu_id == 0) {
         vtm_offset = new_itc - ia64_get_itc();
-        for (i = MAX_VIRT_CPUS - 1; i >= 0; i--) {
+        for (i = d->max_vcpus - 1; i >= 0; i--) {
             if ((v = d->vcpu[i]) != NULL) {
                 VMX(v, vtm).vtm_offset = vtm_offset;
                 VMX(v, vtm).last_itc = 0;
@@ -606,7 +606,7 @@ struct vcpu *lid_to_vcpu(struct domain *d, uint16_t dest)
     int id = dest >> 8;
 
     /* Fast look: assume EID=0 ID=vcpu_id.  */
-    if ((dest & 0xff) == 0 && id < MAX_VIRT_CPUS)
+    if ((dest & 0xff) == 0 && id < d->max_vcpus)
         return d->vcpu[id];
     return NULL;
 }
@@ -875,7 +875,7 @@ static int vlsapic_load(struct domain *d, hvm_domain_context_t *h)
     int i;
 
     vcpuid = hvm_load_instance(h);
-    if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) {
+    if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) {
         gdprintk(XENLOG_ERR,
                  "%s: domain has no vlsapic %u\n", __func__, vcpuid);
         return -EINVAL;
@@ -934,7 +934,7 @@ static int vtime_load(struct domain *d, hvm_domain_context_t *h)
     vtime_t *vtm;
 
     vcpuid = hvm_load_instance(h);
-    if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) {
+    if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) {
         gdprintk(XENLOG_ERR,
                  "%s: domain has no vtime %u\n", __func__, vcpuid);
         return -EINVAL;
index cc898a446c4e4fb5d36e33598a5c5042a4bcfbab..5d822f8a0b521d07d64202e4b0ba89d750584d94 100644 (file)
@@ -623,7 +623,7 @@ int vmx_setup_platform(struct domain *d)
 
        if (d->arch.is_sioemu) {
                int i;
-               for (i = 1; i < MAX_VIRT_CPUS; i++)
+               for (i = 1; i < XEN_LEGACY_MAX_VCPUS; i++)
                        d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
        }
 
index db55279c64f1c9ff02717a3bcbc8f218158ee096..50cfdacd94bf1a9f9186cc3d7f2c51d653fb37e2 100644 (file)
@@ -228,7 +228,7 @@ static int vmx_cpu_load(struct domain *d, hvm_domain_context_t *h)
     struct pt_regs *regs;
 
     vcpuid = hvm_load_instance(h);
-    if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) {
+    if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) {
         gdprintk(XENLOG_ERR,
                  "%s: domain has no vcpu %u\n", __func__, vcpuid);
         rc = -EINVAL;
@@ -278,7 +278,7 @@ static int vmx_vpd_load(struct domain *d, hvm_domain_context_t *h)
     int i;
 
     vcpuid = hvm_load_instance(h);
-    if (vcpuid > MAX_VIRT_CPUS || (v = d->vcpu[vcpuid]) == NULL) {
+    if (vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL) {
         gdprintk(XENLOG_ERR,
                  "%s: domain has no vcpu %u\n", __func__, vcpuid);
         rc = -EINVAL;
index c2c1ea96e8a0577a5d612833d9c16b8551f0b050..f27738d42d171a83b4482ebc344cef6751cb5018 100644 (file)
@@ -233,7 +233,8 @@ long arch_do_domctl(xen_domctl_t *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
             goto sendtrigger_out;
 
         ret = -ESRCH;
-        if ( (v = d->vcpu[op->u.sendtrigger.vcpu]) == NULL )
+        if ( op->u.sendtrigger.vcpu >= d->max_vcpus ||
+             (v = d->vcpu[op->u.sendtrigger.vcpu]) == NULL )
             goto sendtrigger_out;
 
         ret = 0;
index 91ec3bb1a74af79bef01d99484b40f002a4a50b5..11639df53eee34c3b2c6ebc9869bc4d4a7070a42 100644 (file)
@@ -60,7 +60,7 @@ acpi_update_lsapic(struct acpi_subtable_header * header, const unsigned long end
        if (!lsapic)
                return -EINVAL;
 
-       if (lsapic_nbr < MAX_VIRT_CPUS && dom0->vcpu[lsapic_nbr] != NULL)
+       if (lsapic_nbr < dom0->max_vcpus && dom0->vcpu[lsapic_nbr] != NULL)
                enable = 1;
        else
                enable = 0;
index bdc31323c9b0c05b1b286981149ade39fc551f3b..7dde9bf33a987ca31daa7dbe108ac32b9285f426 100644 (file)
@@ -2118,6 +2118,7 @@ int __init construct_dom0(struct domain *d,
 
        /* Sanity! */
        BUG_ON(d != dom0);
+       BUG_ON(d->vcpu == NULL);
        BUG_ON(d->vcpu[0] == NULL);
        BUG_ON(v->is_initialised);
 
@@ -2222,7 +2223,7 @@ int __init construct_dom0(struct domain *d,
        //  (we should be able to deal with this... later)
 
        /* Mask all upcalls... */
-       for ( i = 1; i < MAX_VIRT_CPUS; i++ )
+       for ( i = 1; i < XEN_LEGACY_MAX_VCPUS; i++ )
            d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
 
        printk ("Dom0 max_vcpus=%d\n", dom0_max_vcpus);
index 884bf7b4c3344581633e68d1a18cc78908f43510..24c25cbd83f9b706b7b68b6ca01ab6ec53aa323d 100644 (file)
@@ -84,7 +84,7 @@ fw_hypercall_ipi (struct pt_regs *regs)
        struct domain *d = current->domain;
 
        /* Be sure the target exists.  */
-       if (cpu > MAX_VIRT_CPUS)
+       if (cpu >= d->max_vcpus)
                return;
        targ = d->vcpu[cpu];
        if (targ == NULL)
index a7648fc7d1fcf7227a5d174ca2b6b1cf4837b0ac..f1689df0f4d7e37e3fc92ec9d79302dd01ee46c9 100644 (file)
@@ -231,7 +231,7 @@ domain_purge_swtc_entries_vcpu_dirty_mask(struct domain* d,
 {
        int vcpu;
 
-       for_each_vcpu_mask(vcpu, vcpu_dirty_mask) {
+       for_each_vcpu_mask(d, vcpu, vcpu_dirty_mask) {
                struct vcpu* v = d->vcpu[vcpu];
                if (!v->is_initialised)
                        continue;
@@ -445,7 +445,7 @@ __domain_flush_vtlb_track_entry(struct domain* d,
        }
     
        if (HAS_PERVCPU_VHPT(d)) {
-               for_each_vcpu_mask(vcpu, entry->vcpu_dirty_mask) {
+               for_each_vcpu_mask(d, vcpu, entry->vcpu_dirty_mask) {
                        v = d->vcpu[vcpu];
                        if (!v->is_initialised)
                                continue;
index 7a9773e4112438523ded64f0e4c4c9a83c352312..fbd4cd1adc018cd25bcee88d0520f4f88c54739b 100644 (file)
@@ -31,12 +31,12 @@ static inline int __next_vcpu(int n, const vcpumask_t *srcp, int nbits)
 }
 
 #if MAX_VIRT_CPUS > 1
-#define for_each_vcpu_mask(vcpu, mask)          \
+#define for_each_vcpu_mask(d, vcpu, mask)       \
     for ((vcpu) = first_vcpu(mask);             \
-         (vcpu) < MAX_VIRT_CPUS;                \
+         (vcpu) < d->max_vcpus;                 \
          (vcpu) = next_vcpu((vcpu), (mask)))
 #else /* NR_CPUS == 1 */
-#define for_each_vcpu_mask(vcpu, mask) for ((vcpu) = 0; (vcpu) < 1; (vcpu)++)
+#define for_each_vcpu_mask(d, vcpu, mask) for ((vcpu) = 0; (vcpu) < 1; (vcpu)++)
 #endif /* NR_CPUS */
 
 #define vcpumask_scnprintf(buf, len, src) \